package mylab.starters.dag;

import lombok.Getter;
import lombok.ToString;
import mylab.starters.dag.enums.TaskResultState;

/**
 *  任务执行结果
 */
@ToString
@Getter
public class TaskResult<V> {
    /**
     * 任务id
     */
    String taskId;

    /**
     * 执行的结果
     */
    V result;

    /**
     * 结果状态
     */
    TaskResultState resultState;

    /**
     * 异常信息
     */
    Throwable throwable;

    public TaskResult(String taskId, V result, TaskResultState resultState) {
        this(taskId, result, resultState, null);
    }

    public TaskResult(String taskId, V result, TaskResultState resultState, Exception exception) {
        this.taskId = taskId;
        this.result = result;
        this.resultState = resultState;
        this.throwable = exception;
    }
}